package main

import (
	"bytes"
	"encoding/binary"
	"log"
	"time"

	"gitee.com/general252/ebml-go/examples/container/demo"
	"gitee.com/general252/go-wav"
)

func init() {
	log.SetFlags(log.LstdFlags | log.Lshortfile)
}

// ffmpeg -i input.h264 -vcodec copy             output.mkv
// ffmpeg -i input.mkv  -vcodec copy -an         output.h264
// ffmpeg -i UA_555.mkv -acodec copy -vn -f g726 output.g726
// ffmpeg -i input.mp4 -vn -c:a libopus -b:a 128k output.opus
func main() {
	if false {
		v := time.Now().Truncate(time.Hour * 24)
		log.Println(v)
		return
	}

	if false {
		demo.H264Demo()
	}
	if false {
		demo.HevcDemo()
	}

	if false {
		demo.MarshalOut("input.mkv")
	}
	if false {
		demo.MarshalOut("outH264.mkv")
	}

	if false {
		demo.AACDemo()
	}

	if false {
		demo.H264AACDemo()
	}

	if false {
		if false {
			//r := bytes.NewBuffer([]byte{0x06, 0x00, 0x01, 0x00, 0x40, 0x1f, 0x00, 0x00, 0xa0, 0x0f, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00})
			r := bytes.NewBuffer([]byte{0x45, 0x00, 0x01, 0x00, 0x40, 0x1f, 0x00, 0x00, 0xa0, 0x0f, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00})
			var wavFormat wav.WavFormat
			_ = binary.Read(r, binary.LittleEndian, &wavFormat)
			log.Println(wavFormat)
		}

		demo.G711ADemo()
	}

	if false {
		demo.G726Demo()
	}

	if false {
		demo.OpusDemo()
	}
}
